package leeon.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class JavaService {
	
	private static Log logger = LogFactory.getLog(JavaService.class);
	
	public static String DB_URL = "jdbc:oracle:thin:@" +
			"(DESCRIPTION=" +
				"(ADDRESS=(PROTOCOL=TCP)(HOST=10.7.71.85)(PORT=1521))" +
				"(ADDRESS=(PROTOCOL=TCP)(HOST=10.7.71.86)(PORT=1521))" +
				"(LOAD_BALANCE=ON)" +
				"(FAILOVER=ON)" +
				"(CONNECT_DATA=" +
					"(SERVER=DEDICATED)" +
					"(SERVICE_NAME=wlzyyw)" +
				")" +
			")";
	//public static String DB_URL = "jdbc:oracle:oci8:@wzywdb";
	public static String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
	public static String DB_USERNAME = "sharedb_nm";
	public static String DB_PASSWORD = "sharedb_netmaster";

	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Connection conn = null;
		try {
			Class.forName(DB_DRIVER);
	        conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
	        
	        logger.info(conn.isClosed());
	        
		} catch (Exception e) {
			logger.error("error when update log", e);
		} finally {
			try {
				if (conn != null && !conn.isClosed()) conn.close();
			} catch (SQLException e) {
				logger.error("error close connection", e);
			}
		}
	}
	
	
	public static void systemExit() {
		logger.info("结束");
	}

}
